<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0" />
	<title>我的接单</title>
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" th:href="@{/weixin/css/weui.min.css}" />
	<link rel="stylesheet" href="/static/weixin/css/style.css" th:href="@{/weixin/css/style.css}" />
	<link rel="stylesheet" th:href="@{/weixin/css/dropload.css}" />
	<script type="text/javascript" src="../../static/weixin/js/zepto.min.js" th:src="@{/weixin/js/zepto.min.js}"></script>
	<script type="text/javascript" src="../../static/weixin/js/weui.min.js" th:src="@{/weixin/js/weui.min.js}"></script>
	<script type="text/javascript"  th:src="@{/weixin/js/dropload.min.js}"></script>
	<script type="text/javascript" src="../../static/weixin/js/adaptive.js" th:src="@{/weixin/js/adaptive.js}"></script>
</head>
<body>
	<section class="wrapper">
	
		<ul class="houseList">
			
		</ul>
		
		
		
	</section>
	
	<script  th:inline="JavaScript">
	var majors = /*[[${majors}]]*/ null;
    var styles = /*[[${styles}]]*/ null;
	//页数 
	$(function(){
		reload();
	});

	/*<![CDATA[*/
var page = 0;
function reload(){
	$('.houseList').html('');
    $('.dropload-down').remove();
    
    page = 0;
    $('.wrapper').dropload(opt);
}	           
var opt = {
    scrollArea : window,
    autoLoad : true,//自动加载
    loadDownFn : function(me){
     window.history.pushState(null, document.title, window.location.href);
        $.ajax({
            type: 'GET',
            url:'/mall/weixin/requirement/my/list?page='+page,
            dataType: 'json',
            success: function(data){
                if(data.content.length == 0){
                    me.lock();
                    me.noData();
                    me.resetload();
                    return;
                }

		        var result = '';
                for(var i=0; i< data.content.length; i++){
                  result+=content(data.content[i]);
                }
                
                $('.houseList').append(result);
                page++;
                me.resetload();
            },
            error: function(xhr, type){
                alert('Ajax error!');
                me.resetload();
            }
        });
    }
};

function content(data){
	return '<li class="box-h"><div class="flex" id="'+data.id+'">'+
	'<p class="name">'+data.title+'</p>'+
	'<p class="tip">'+ellipsis(data.description)+'</p>'+
	'<p class="tagBox">'+
		'<span>'+data.size+' ㎡</span>'+
		'<span>'+dict(data.industry, majors)+'</span>'+
		'<span>'+dict(data.style, styles) +'</span>'+
	'</p>'+
	'<p class="price"><sub>￥</sub>'+data.price+'</p>'+
	'</div></li>'
}

function dict(value, arr){
	for(var i in arr){
		if(value == arr[i]["value"])
			return arr[i]["name"];
	}
}

function ellipsis(text){
	return (text.length > 20)? (text.substring(0, 80) + "...") : text ;
}

weui.alert("请前往PC端查看详细信息")
/*]]>*/
</script>   
</body>
</html>